<?php echo $head?>
<div class="right-content">
    <div class="clearfix">
        <div class="we7-padding-bottom clearfix">
            <div class="pull-right">
                <a href="javascript:void(0);" data-toggle="modal" data-target="#user-modal" class="btn btn-primary we7-padding-horizontal">添加权限</a>
            </div>
        </div>
        <table class="table we7-table table-hover">
            <thead class="navbar-inner">
            <tr>
                <th class="text-center" style="width:10px;">ID</th>
                <th class="text-center" style="width:150px;">权限名称</th>
                <th class="text-center" style="width:100px">上级权限</th>
                <th class="text-center" style="width:350px">权限路由</th>
            </tr>
            </thead>
            <tbody>
            <?php
                foreach($data as $k=>$v){
                    echo "
            <tr>
                <td class=\"text-center\" style=\"width:10px;\">{$v['id']}</td>
                <td class=\"text-center\" style=\"width:150px;\">{$v['name']}</td>
                <td class=\"text-center\" style=\"width:100px;\">{$v['level']}</td>
                <td class=\"text-center\" style=\"width:300px;\">{$v['route']}</td>
            </tr>
            ";
                }
            ?>

            </tbody>
        </table>

        <!-- 添加应用操作员模态框 -->
        <div class="modal" id="user-modal" style="display: none;">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                        <h3 class="modal-title"><span style="color: red">添加权限请联系程序员添加</span></h3>
                    </div>
                    <form action="/admin/jurisdiction/j_add" method="post">
                        <input type="hidden" name="id" value="0">
                        <input type="hidden" name="m" value="junsion_winaward">
                        <div class="modal-body we7-form">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">权限名称</label>
                                <div class="col-sm-10">
                                    <input id="add-username" name="name" type="text" class="form-control">
                                    <span class="help-block">请输入权限名称。</span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">上级权限</label>
                                <div class="col-sm-10">
                                    <select name="superior" >
                                        <option value="0"><span style="color: red">请选择上级权限</span></option>
                                        <?php
                                            foreach($data as $k=>$v){
                                                echo "<option value='{$v['id']}'>{$v['name']}</option>";
                                            }
                                        ?>
                                    </select>
                                    <span class="help-block"><span style="color: red">请选择上级权限 如不选择 则为顶级权限</span></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">权限路由</label>
                                <div class="col-sm-10">
                                    <input id="add-username" name="route" type="text" class="form-control">
                                    <span class="help-block">请输入渠道路由 <span style="color: red">联系程序员添加</span></span>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="submit" class="btn btn-primary">确认</button>
                            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>

        <div class="form-group module-permission">
            <label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label">二级权限</label>
            <div class="col-sm-10 col-lg-10 col-xs-12">
                <?php
                    foreach($array as $k=>$v){
                        echo "<div class=\"col-sm-10 col-lg-10 col-xs-12 plugin-name\">{$v['data']['name']}</div>";
                        foreach($v['list'] as $key=>$val){
                            echo "<div class=\"col-sm-4 dropdown\" > <span class=\"checkbox\">{$val['name']}</span></div>";
                        }
                    }
                ?>
            </div>
        </div>

    </div>
</div>